package fact.view.controller;


import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;

@ManagedBean(name = "logoutBean")
@RequestScoped
public class LogoutBean {


	
    public String logout() {
    	FacesContext.getCurrentInstance (). getExternalContext (). getSessionMap (). clear (); 
        return "/faces/index.jsf?faces-redirect=true";
    }
    
    
    /*
       
	        ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();  
	        FacesContext.getCurrentInstance (). getExternalContext (). getSessionMap (). clear ();  
	        HttpServletRequest request = (HttpServletRequest) context.getRequest();  
	        try {  
	  	           
	            HttpServletResponse response = (HttpServletResponse) context.getResponse();  
	            response.sendRedirect("index.jsf");  
	        } catch (IOException e) {  
	//do logging   
	        }  
	    }  
	    */

    // ...

}